home *** CD-ROM | disk | FTP | other *** search
Wrap
; NSIS Script For Miranda Installer ; requires MakeNSIS v2.0b0 ; Script by Kai Blankenhorn <kai_b@users.sourceforge.net> !include "${NSISDIR}\Contrib\Modern UI\System.nsh" !define LONGNAME "Miranda Installer" !define SHORTNAME "MirInst" !define MUI_PRODUCT "${LONGNAME}" !define MUI_VERSION "0.0.1.2" Name "${MUI_PRODUCT} ${MUI_VERSION}" !define MUI_WELCOMEPAGE !define MUI_LICENSEPAGE !define MUI_COMPONENTSPAGE !define MUI_DIRECTORYPAGE !define MUI_STARTMENUPAGE !define MUI_FINISHPAGE !define MUI_FINISHPAGE_NOAUTOCLOSE !define MUI_FINISHPAGE_RUN "$INSTDIR\${SHORTNAME}.exe" !define MUI_UNINSTALLER !define MUI_UNCONFIRMPAGE !define MUI_ABORTWARNING !insertmacro MUI_LANGUAGE "English" ; not needed anymore (inserted automatically) ; !insertmacro MUI_SYSTEM LangString DESC_SecProgFiles ${LANG_ENGLISH} "Copy program files and the readme file." LangString DESC_SecFileExts ${LANG_ENGLISH} "Register file types to ${LONGNAME}. This can also be done later in the program." LangString DESC_SecSource ${LANG_ENGLISH} "Copy detailed instructions on how to use ${LONGNAME} for your Miranda addon. Also contains the ${LONGNAME} source code and translation strings." CRCCheck On OutFile "${SHORTNAME}_${MUI_VERSION}_Setup.exe" ;LicenseData "gpl.rtf" LicenseData "copying.txt" InstType "Typical" InstType "Minimal" InstType "Developer" Function .onInit SetCompress Auto SetOverwrite IfNewer SetShellVarContext "all" StrCpy $INSTDIR "" ;if Miranda Installer has been installed before, use old location ReadRegStr $INSTDIR HKLM "SOFTWARE\${LONGNAME}" "Install_Dir" StrCmp $INSTDIR "" +1 EndDetectInstallPath ;if Miranda is installed, use its directory as install directory ReadRegStr $1 HKLM "SOFTWARE\Miranda" "Install_Dir" StrCmp $1 "" NotInstalled StrCpy $INSTDIR "$1\Tools\${SHORTNAME}" Goto EndDetectInstallPath ;otherwise, use generic install directory NotInstalled: StrCpy $INSTDIR "$PROGRAMFILES\Miranda\Tools\${SHORTNAME}" EndDetectInstallPath: FunctionEnd Section "Program files (required)" SecProgFiles SectionIn 1 2 3 RO SetOutPath $INSTDIR WriteRegStr HKLM "SOFTWARE\${LONGNAME}" "Install_Dir" $INSTDIR File "release\${SHORTNAME}.exe" File "copying.txt" SectionEnd Section "-Start Menu shortcuts" SectionIn 1 3 !insertmacro MUI_STARTMENU_WRITE_BEGIN ;Create shortcuts CreateDirectory "$SMPROGRAMS\${MUI_STARTMENUPAGE_VARIABLE}" CreateShortCut "$SMPROGRAMS\${MUI_STARTMENUPAGE_VARIABLE}\${LONGNAME}.lnk" "$INSTDIR\${SHORTNAME}.exe" CreateShortCut "$SMPROGRAMS\${MUI_STARTMENUPAGE_VARIABLE}\Uninstall.lnk" "$INSTDIR\Uninstall.exe" ;Write shortcut location to the registry (for Uninstaller) WriteRegStr HKLM "Software\${LONGNAME}" "Start Menu Folder" "$SMPROGRAMS\${MUI_STARTMENUPAGE_VARIABLE}" !insertmacro MUI_STARTMENU_WRITE_END SectionEnd Section "Register file extensions" SecFileExts SectionIn 1 3 DetailPrint "Registering application" WriteRegStr HKCR "${SHORTNAME}" "" "${LONGNAME}" WriteRegBin HKCR "${SHORTNAME}" "EditFlags" 00000100 WriteRegStr HKCR "${SHORTNAME}\DefaultIcon" "" "$INSTDIR\${SHORTNAME}.exe,1" WriteRegStr HKCR "${SHORTNAME}\shell\open" "" "&Install" WriteRegStr HKCR "${SHORTNAME}\shell\open\command" "" '"$INSTDIR\${SHORTNAME}.exe" "%1"' ReadRegStr $0 HKCR ".zip" "" StrCmp $0 "" NoZIP ReadRegStr $1 HKCR "$0\shell\open\command" "" StrCmp $0 "" NoZIP WriteRegStr HKCR "${SHORTNAME}\shell\openZIP" "" "Open as &ZIP" WriteRegStr HKCR "${SHORTNAME}\shell\openZIP\command" "" $1 NoZIP: DetailPrint "Registering extensions" WriteRegStr HKCR ".mir" "" "${SHORTNAME}" WriteRegStr HKCR ".mir" "Content Type" "application/x-zip-mirandainstaller" WriteRegStr HKCR ".mii" "" "${SHORTNAME}" WriteRegStr HKCR ".mii" "Content Type" "application/x-zip-mirandainstaller" WriteRegStr HKCR ".mis" "" "${SHORTNAME}" WriteRegStr HKCR ".mis" "Content Type" "application/x-zip-mirandainstaller" WriteRegStr HKCR ".mil" "" "${SHORTNAME}" WriteRegStr HKCR ".mil" "Content Type" "application/x-zip-mirandainstaller" WriteRegStr HKCR ".mit" "" "${SHORTNAME}" WriteRegStr HKCR ".mit" "Content Type" "application/x-zip-mirandainstaller" WriteRegStr HKCR ".mio" "" "${SHORTNAME}" WriteRegStr HKCR ".mio" "Content Type" "application/x-zip-mirandainstaller" WriteRegStr HKCR ".mic" "" "${SHORTNAME}" WriteRegStr HKCR ".mic" "Content Type" "application/x-zip-mirandainstaller" WriteRegStr HKCR ".mik" "" "${SHORTNAME}" WriteRegStr HKCR ".mik" "Content Type" "application/x-zip-mirandainstaller" WriteRegStr HKCR ".min" "" "${SHORTNAME}" WriteRegStr HKCR ".min" "Content Type" "application/x-zip-mirandainstaller" SectionEnd Section "Developer information" SecSource SectionIn 3 SetOutPath $INSTDIR File "Syntax.txt" File "devinfo.txt" File "Strings.txt" SetOutPath "$INSTDIR\Source" File "*.cpp" File "*.h" File "*.ico" File "mirandainstaller.manifest" File "Resource.rc" File "copying.txt" File "notes.txt" File "MirandaInstaller.ds*" File "MirInst.nsi" File "hand.cur" File /r "zlib" File /r "langpack" SetOutPath $INSTDIR SectionEnd Section "Uninstall" Delete "$INSTDIR\uninstall.exe" Delete "$INSTDIR\${SHORTNAME}.exe" Delete "$INSTDIR\copying.txt" Delete "$INSTDIR\devinfo.txt" Delete "$INSTDIR\strings.txt" Delete "$INSTDIR\Syntax.txt" Delete "$INSTDIR\Options.dat" RMDir /r "$INSTDIR\Source" ReadRegStr $0 HKLM "SOFTWARE\${LONGNAME}" "Start Menu Folder" StrCmp $0 "" NoStartMenu RMDir /r "$0" NoStartMenu: RMDir /r $INSTDIR DeleteRegKey HKCR "${SHORTNAME}" DeleteRegKey HKCR ".mir" DeleteRegKey HKCR ".mii" DeleteRegKey HKCR ".mis" DeleteRegKey HKCR ".mil" DeleteRegKey HKCR ".mit" DeleteRegKey HKCR ".mio" DeleteRegKey HKCR ".mic" DeleteRegKey HKCR ".mik" DeleteRegKey HKCR ".min" ;DeleteRegKey HKCU "SOFTWARE\${LONGNAME}" DeleteRegKey HKLM "SOFTWARE\${LONGNAME}" DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${LONGNAME}" SectionEnd Section "-Uninstall Support" SecUninstall WriteUninstaller "$INSTDIR\uninstall.exe" WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${LONGNAME}" "DisplayName" "${LONGNAME}" WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${LONGNAME}" "UninstallString" "$INSTDIR\uninstall.exe" SectionEnd !insertmacro MUI_FUNCTIONS_DESCRIPTION_BEGIN !insertmacro MUI_DESCRIPTION_TEXT ${SecProgFiles} $(DESC_SecProgFiles) !insertmacro MUI_DESCRIPTION_TEXT ${SecFileExts} $(DESC_SecFileExts) !insertmacro MUI_DESCRIPTION_TEXT ${SecSource} $(DESC_SecSource) !insertmacro MUI_FUNCTIONS_DESCRIPTION_END